import Vue from 'vue'
import Vuex from 'vuex'
import { userhttp } from "../http/requset";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userarr: []
  },
  mutations: {
    GETUSER(state, val) {
      console.log(val);
      state.userarr=val.data.users
    }
  },
  actions: {
    getuser({ commit }) {
      userhttp({
          pagenum: 1,
          pagesize: 20,
        }).then(res => {
          commit('GETUSER', res.data)
        })
    }
  },
  modules: {
  }
})
